﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

namespace Xeml.Document
{
    public class Term : XemlAnnotatableObject, INotifyPropertyChanged
    {
        private string _nameSpaceAlias;
        private string _nameSpace;
        private string _name;
        private string _termId;

        #region Properties

        public string Name
        {
            get { return _name; }
            set
            {
                if (_name != value)
                {
                    _name = value;
                    OnPropertyChanged("Term");
                }
            }
        }

        public string NameSpaceAlias
        {
            get { return _nameSpaceAlias; }
            set
            {
                if (_nameSpaceAlias != value)
                {
                    _nameSpaceAlias = value;
                    OnPropertyChanged("NameSpaceAlias");
                }
            }
        }

        public string NameSpace
        {
            get { return _nameSpace; }
            internal set
            {
                if (_nameSpace != value)
                {
                    _nameSpace = value;
                    OnPropertyChanged("NameSpace");
                }
            }
        }

        #endregion

        #region ctors
        public Term(string termId)
        {
            _termId = termId;
        }

        public Term(string termId, string nameSpace, string nameSpaceAlias)
        {
            _termId = termId;
            _nameSpace = nameSpace;
            _nameSpaceAlias = nameSpaceAlias;
        }

        public Term(Term m)
            : base(m)
        {
            _nameSpaceAlias = m.NameSpaceAlias;
            _nameSpace = m.NameSpace;
            _name = m.Name;
            _termId = m.TermId;
        } 
        #endregion

     

        private TermCollection _collection;
        public TermCollection Collection
        {
            get
            {
                return this._collection;
            }
            set
            {
                if (_collection != value)
                {
                    this._collection = value;
                    OnPropertyChanged("Collection");
                }
            }
        }

       
      
        public string TermId
        {
            get { return _termId; }
        }


        #region INotifyPropertyChanged Members

        protected virtual void OnPropertyChanged(string propName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }

}
